﻿/*****************************************介绍*****************************************
 * 作者：Ywh
 * 创建时间：2024-05-25 14:04:01
 * 功能：继承自Mono的单例，需要手动挂载
**************************************************************************************/

using UnityEngine;

public abstract class SingletonMonoManual<TMono> : MonoBehaviour where TMono : MonoBehaviour
{
    protected static TMono m_Instance;

    protected virtual void Awake()
    {
        if (m_Instance != null)
        {
            Destroy(this);
            return;
        }
        m_Instance = this as TMono;
        DontDestroyOnLoad(gameObject);
    }

    public static TMono Instance => m_Instance;
}